**********************************************************************************************
* Reproduces Table A5
*
* Ajzenman, Elacqua, Jaimovich and Pérez-Núñez (2024)."Humans versus Chatbots: Scaling-up behavioral interventions to reduce teacher shortages"  	  		
*
**********************************************************************************************



///// Preschool Outcomes

*Preferences and Enrollment in Preschool Programs: Considering Human and Bot Effects. This analysis incorporates the interaction between the dummy variable for individuals interested in education and each of the control variables.

reg preschool_rankfirst i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5a.tex", replace sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean))  nocons


foreach var in preschool_proportion preschool_listed d_enroll_preschool{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5a.tex", append sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean))  nocons
eststo clear
}

*Human vs Bot effect differences p-value
foreach var in preschool_rankfirst preschool_proportion preschool_listed d_enroll_preschool{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
test 1.grupo_gen=2.grupo_gen	
}




///// Primary Outcomes
 
*Preferences and Enrollment in Primary Programs: Considering Human and Bot Effects. This analysis incorporates the interaction between the dummy variable for individuals interested in education and each of the control variables.

reg primary_rankfirst i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5b.tex", replace sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean)) label nocons


foreach var in primary_proportion primary_listed d_enroll_primary{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5b.tex", append sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean)) label nocons
eststo clear
}

*Human vs Bot effect differences p-value
foreach var in primary_rankfirst primary_proportion primary_listed d_enroll_primary{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
test 1.grupo_gen=2.grupo_gen	
}




///// Specialized Outcomes

*Preferences and Enrollment in Specialized Programs: Considering Human and Bot Effects. This analysis incorporates the interaction between the dummy variable for individuals interested in education and each of the control variables.

reg specialized_rankfirst i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5c.tex", replace sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean))  nocons


foreach var in specialized_prop specialized_listed d_enroll_specialized{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
estadd ysumm 
outreg2 using "${output}/TableA5c.tex", append sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean))  nocons
eststo clear
}

*Human vs Bot effect differences p-value
foreach var in specialized_rankfirst specialized_prop specialized_listed d_enroll_specialized{
	
reg `var' i.grupo_gen education_preference##sexo education_preference##i.dependencia_colegio education_preference##top_30, r
test 1.grupo_gen=2.grupo_gen	
}



*Note: Calculations of the significant difference in the bot vs human effect were manually added to the table according to the results produced by the commands run earlier in this code.